package com.ssy.lingxi.platform.manage.repository;

import com.ssy.lingxi.platform.manage.entity.content.MemberCategory;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MemberCategoryRepository extends JpaRepository<MemberCategory, Long>, JpaSpecificationExecutor<MemberCategory> {

    List<MemberCategory> findAllByMemberIdAndMemberRoleIdAndLevel(Long memberId, Long memberRoleId, Integer level, Sort id);

    List<MemberCategory> findAllByMemberIdAndMemberRoleIdAndStatusAndLevel(Long memberId, Long memberRoleId, Integer status, Integer level);

    Boolean existsByParentId(Long parentId);

    List<MemberCategory> findAllByMemberIdAndMemberRoleId(Long memberId, Long memberRoleId);

    List<MemberCategory> findAllByMemberIdAndMemberRoleIdAndNameContaining(Long memberId, Long memberRoleId, String searchContent);
}
